package com.tarena.vehicle.management.converter;

import com.tarena.vehicle.management.pojo.entity.VehicleInspection;
import com.tarena.vehicle.management.pojo.entity.VehicleMaintenance;
import com.tarena.vehicle.management.pojo.param.VehicleInspectionAddNewParam;
import com.tarena.vehicle.management.pojo.param.VehicleInspectionUpdateParam;
import com.tarena.vehicle.management.pojo.param.VehicleMaintenanceAddNewParam;
import com.tarena.vehicle.management.pojo.param.VehicleMaintenanceUpdateParam;
import com.tarena.vehicle.management.pojo.query.VehicleInspectionQuery;
import com.tarena.vehicle.management.pojo.query.VehicleMaintenanceQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@Component
public class VehicleMaintenanceConverter {

    public VehicleMaintenance param2po(VehicleMaintenanceAddNewParam param) {
        VehicleMaintenance vehicleMaintenance = new VehicleMaintenance();
        BeanUtils.copyProperties(param,vehicleMaintenance);
        vehicleMaintenance=setUserMessage(vehicleMaintenance);
        return vehicleMaintenance;
    }

    public VehicleMaintenance param2po(VehicleMaintenanceUpdateParam param) {
        VehicleMaintenance vehicleMaintenance = new VehicleMaintenance();
        BeanUtils.copyProperties(param,vehicleMaintenance);
        vehicleMaintenance=setUserMessage(vehicleMaintenance);
        return vehicleMaintenance;
    }


    public VehicleMaintenance query2po(VehicleMaintenanceQuery query) {
        VehicleMaintenance vehicleMaintenance = new VehicleMaintenance();
        BeanUtils.copyProperties(query,vehicleMaintenance);
        return vehicleMaintenance;
    }

    public VehicleMaintenance setUserMessage(VehicleMaintenance vehicleMaintenance){
        vehicleMaintenance.setUid(1);
        vehicleMaintenance.setOrgid(1);
        vehicleMaintenance.setCompanyCode("JSDTN2210");
        return vehicleMaintenance;
    }

}
